package com.itlong.cloud.equip.property;

import com.itlong.cloud.POJO.DTO.app.AppUploadPassRecordDTO;
import com.itlong.cloud.POJO.DTO.property.*;
import com.itlong.cloud.POJO.PO.DeviceCloudIntercomInfoPO;
import com.itlong.cloud.POJO.PO.RoomInfoPO;
import com.itlong.cloud.POJO.VO.property.*;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      云对讲设备管理服务暴露接口
 * </desc>
 *
 * @createDate 2017-11-15.
 */
@FeignClient(name = "equip-service")
public interface ICloudIntercomServiceClient {
    /**
     * <desc>
     *      判断sn存在性
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2018-01-02
     */
    @RequestMapping(path = "smartCommunity/interface/device/checkSnExist",method = {RequestMethod.POST})
    Integer checkSnExist(@RequestParam("sn") String sn) throws Exception;

    /**
     * <desc>
     *      根据sn查询云对讲设备业务服务器信息
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-15
     */
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceServer",method = {RequestMethod.POST})
    CloudIntercomDeviceVO getDeviceServer(@RequestParam(name = "sn") String sn) throws Exception;

    /**
     * <desc>
     *      设备端连接云端认证
     * <desc/>
     *
     * @param sn
     * @return 
     * @author Chunjian.G
     * @createDate 2017-11-15
     */
    @RequestMapping(path = "smartCommunity/interface/device/login",method = {RequestMethod.POST})
    CloudIntercomDeviceVO cloudIntercomLogin(@RequestParam(name = "sn") String sn,
                                             @RequestParam(value = "newDevice",required = false) String newDevice) throws Exception;

    /**
     * <desc>
     *      从缓存中获取云对讲服务信息
     * <desc/>
     *
     * @param token 设备token
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-16
     */
    @RequestMapping(path = "smartCommunity/interface/device/retrieve",method = {RequestMethod.POST})
    CloudIntercomDeviceCacheVO retrieve(@RequestParam(name = "token") String token) throws Exception;

    /**
     * <desc>
     *      设备端上电请求云端获取license与md5串
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/20
     */
    @RequestMapping(path = "smartCommunity/interface/device/getLicense",method = RequestMethod.POST)
    DeviceCloudIntercomInfoPO getLicense(@RequestParam("sn") String sn);


    /**
     * <desc>
     *       云端接收QQ与TinyID映射信息
     * </desc>
     *
     * @param sn 设备唯一码
     * @param din
     * @param qqTinyDTOS 映射信息列表
     * @return 未注册列表
     * @author Jiaqi.X
     * @createDate 2017/11/20
     */
    @RequestMapping(path = "smartCommunity/interface/device/pushQQAndTinyId",method = RequestMethod.POST)
    List<PropertyCloudQqTinyDTO> pushQQAndTinyId(@RequestParam("sn") String sn,
                                                 @RequestParam("din") String din,
                                                 @RequestBody List<PropertyCloudQqTinyDTO> qqTinyDTOS) throws IOException;


    /**
     * <desc>
     *      云端接收设备端的通行记录
     * </desc>
     *
     * @param sn
     * @param type  记录类型 4表示电话呼叫，7表示设备上密码通行
     * @param deviceRecordJson json映射信息
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/21
     */
    @RequestMapping(path = "smartCommunity/interface/device/pushDeviceRecord",method = RequestMethod.POST)
    Integer pushDeviceRecord(@RequestParam("sn") String sn,
                             @RequestParam("type") Integer type,
                             @RequestParam("deviceRecordJson") String deviceRecordJson,
                             @RequestParam("deviceType") String deviceType) throws Exception;


    /**
     * <desc>
     *      云端接收H5端上传的通行记录
     * </desc>
     *
     * @param sn 云对讲sn
     * @param type 2表示QQ呼叫 3表示用户本人通行
     * @param deviceRecordJson json数据
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/22
     */
    @RequestMapping(path = "smartCommunity/interface/device/pushQqRecord",method = RequestMethod.POST)
    Integer pushQqRecord(@RequestParam("sn") String sn,
                         @RequestParam("type") Integer type,
                         @RequestParam("deviceRecordJson") String deviceRecordJson) throws Exception;

    /**
     * <desc>
     *      云端接收PAD人脸认证的通行记录
     * </desc>
     *
     * @param appUploadPassRecordDTO 通行记录信息
     * @return
     * @author Qiang.S
     * @createDate 2018/05/16
     */
    @RequestMapping(path = "/smartCommunity/interface/device/pushPadFaceRecord",method = RequestMethod.POST)
    Integer pushPadFaceRecord(@RequestBody AppUploadPassRecordDTO appUploadPassRecordDTO) throws Exception;


    /**
     * <desc>
     *      校验开门动态密码（校验成功后生成动态密码通行记录）
     * <desc/>
     *
     * @param checkDTO 动态密码信息
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-27
     */
    @RequestMapping(path = "smartCommunity/interface/device/checkDynamicPwd",method = RequestMethod.POST)
    Boolean checkDynamicPwd(@RequestBody CloudIntercomDynamicPwdCheckDTO checkDTO) throws Exception;



    /**
     * <desc>
     *      获取云对讲设备服务权限信息
     * <desc/>
     *
     * @param getDTO 获取云对讲服务权限DTO
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-16
     */
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceServeRoomsByPage",method = {RequestMethod.POST})
    Page<CloudIntercomDeviceAuthVO.Room> getDeviceServeRoomsByPage(@RequestBody CloudIntercomDeviceAuthGetDTO getDTO) throws Exception;

    /**
     * <desc>
     *      获取房间下的住户信息
     * <desc/>
     *
     * @param roomIds 房间id
     * @return
     * @author Chunjian.G
     * @createDate 2018-01-29
     */
    @RequestMapping(path = "smartCommunity/interface/device/getUsersByRoomIds",method = {RequestMethod.POST})
    List<CloudIntercomDeviceAuthVO.RoomUser> getUsersByRoomIds(@RequestParam("roomIds") String roomIds,@RequestParam("sn") String sn) throws Exception;

    /**
     * <desc>
     *      获取云对讲设备附加信息
     * <desc/>
     *
     * @param deviceUnique 云对讲设备唯一码
     * @return 
     * @author Chunjian.G
     * @createDate 2017-11-20
     */
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceOtherInfo",method = {RequestMethod.POST})
    CloudIntercomOtherInfoVO getDeviceOtherInfo(@RequestParam("deviceUnique") String deviceUnique) throws Exception;


    /**
     * <desc>
     *      获取云对讲设备需要展示的多媒体信息
     * <desc/>
     *
     * @param getDTO 获取云对讲多媒体展示信息
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-22
     */
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceMedias",method = {RequestMethod.POST})
    List<CloudIntercomMediaVO> getDeviceMedias(@RequestBody CloudIntercomMediaGetDTO getDTO) throws Exception;


    /**
     * <desc>
     *      获取云对讲设备状态（1:可用  2:禁用）
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-23
     */
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceState",method = {RequestMethod.POST})
    Integer getDeviceState(@RequestParam("sn") String sn) throws Exception;


    /**
     * <desc>
     *      获取云对讲设备二维码
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-23
     */
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceQrcodeUrl",method = {RequestMethod.POST})
    String getDeviceQrcodeUrl(@RequestParam("sn") String sn) throws Exception;


    /**
     * <desc>
     *      获取云对讲轮询命令
     * <desc/>
     *
     * @param getDTO 轮询命令分页
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-25
     */
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceChangeLogOrders",method = {RequestMethod.POST})
    Page<CloudIntercomChangeLogOrderVO> getDeviceChangeLogOrders(@RequestBody CloudIntercomChangeLogGetDTO getDTO) throws Exception;

    /**
     * <desc>
     *      云对讲设备批量完成轮询命名
     * <desc/>
     *
     * @param sn
     * @param ids 轮询命令，多个以英文逗号拼接
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-25
     */
    @RequestMapping(path = "smartCommunity/interface/device/finishChangeLogOrders",method = {RequestMethod.POST})
    Integer finishChangeLogOrders(@RequestParam("sn") String sn,
                                  @RequestParam("ids") String ids) throws Exception;


    /**
     * <desc>
     *      同一项目下，根据userSip获取手机号
     * <desc/>
     *
     * @param projectId 项目编号
     * @param userSips 用户sip，多个以英文逗号拼接
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-25
     */
    @RequestMapping(path = "smartCommunity/interface/device/getPhoneNoByUserSips",method = {RequestMethod.POST})
    List<String> getPhoneNoByUserSips(@RequestParam("projectId") String projectId,
                                      @RequestParam("userSips") String userSips) throws Exception;



    /**
     * <desc>
     *      检查用户是否有权限
     * <desc/>
     *
     * @param sn
     * @param tinyId qq物联id
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-27
     */
    @RequestMapping(path = "smartCommunity/interface/device/checkUserByTinyId",method = {RequestMethod.POST})
    Boolean checkUserByTinyId(@RequestParam("sn") String sn, @RequestParam("tinyId") String tinyId) throws Exception;

    /**
     * <desc>
     *      获取云对讲人脸识别配置信息
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.X
     * @createDate 2018/05/21
     */
    @RequestMapping(path = "smartCommunity/interface/device/pullDeviceInfo")
    CloudTalkFaceApplyInfoVO pullDeviceInfo(@RequestParam("sn") String sn);

    /**
     * <desc>
     *      获取云对讲iot信息
     * </desc>
     *
     * @param sn
     * @return
     * @author Qiang.S
     * @createDate 2019/07/16
     */
    @RequestMapping(path = "smartCommunity/interface/device/getCloudTalkIotInfo")
    CloudTalkIotInfoVO getCloudTalkIotInfo(@RequestParam("sn") String sn);

    /**
     * <desc>
     *      根据SN号获取设备待机界面图片
     * <desc/>
     *
     * @param sn
     * @return
     * @author Juguang.S
     * @createDate 2018-08-09
     */
    @RequestMapping(path = "smartCommunity/interface/device/pullStandbyInterfacePicture")
    String getStandbyInterfacePicture(@RequestParam("sn") String sn);

    /**
     * <desc>
     *      云对讲上报设备的能力集信息
     * <desc/>
     *
     * @param sn
     * @param capacitySet 表示设备支持哪些功能，有哪些能力 json String数据
     * @return
     * @author Juguang.S
     * @createDate 2018-08-09
     */
    @RequestMapping(path = "smartCommunity/interface/device/reportCapacitySet")
    void reportCapacitySet(@RequestParam("capacitySet") String capacitySet,@RequestParam("sn") String sn);

    /**
     * <desc>
     *      获取云对讲设备更新信息
     * </desc>
     *
     * @param sn
     * @param filePackage 安装文件 包名
     * @param versionCode 安装文件 版本号
     * @param deviceType 软件类型 0安卓APK程序，1安卓系统固件，2按键单片机固件
     * @return
     * @author Qiang.S
     * @createDate 2018/08/30
     */
    @RequestMapping(path = "smartCommunity/interface/device/deviceIntercomUpdate")
    CloudDeviceUpdateInfoVO deviceIntercomUpdate(@RequestParam("sn") String sn,
                                                 @RequestParam(value = "filePackage",required = false) String filePackage,
                                                 @RequestParam("versionCode") String versionCode,
                                                 @RequestParam("deviceType") String deviceType);

    /**
     * <desc>
     *      根据roomId projectId判定该房间下的业主是否被冻结
     * </desc>
     *
     * @param roomId 房间ID
     * @param projectId 项目ID
     * @return
     * @author Juguang.S
     * @createDate 2018/11/22
     */
    @RequestMapping(path = "smartCommunity/interface/device/getUserStatusProject")
    Integer getUserStatusProject(@RequestParam("roomId") String roomId,
                                 @RequestParam("projectId") String projectId);


    /**
     * <desc>
     *      获取单元代号
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.x
     * @createDate 2018/11/27
     */
    @PostMapping(path = "smartCommunity/interface/device/getUnitAlias")
    List<Map<String,Object>> getUnitAlias(@RequestParam("sn") String sn);

    /**
     * <desc>
     *      通过百度id来校验该百度Id是否未绑定过百度授权码
     * <desc/>
     *
     * @param baiduId 百度指纹码
     * @return
     * @author Juguang.S
     * @createDate 2019/03/12
     */
    @PostMapping(path = "smartCommunity/interface/device/getBaiduIdBingStatus")
    Integer getBaiduIdBingStatus(@RequestParam("baiduId") String baiduId);

    /**
     * <desc>
     *      根据deviceUnique查询该设备是否已绑定或已购买
     * <desc/>
     *
     * @param deviceUnique 设备唯一码
     * @return
     * @author Juguang.S
     * @createDate 2019/03/12
     */
    @PostMapping(path = "smartCommunity/interface/device/getDeviceBuyOrBingStatus")
    Integer getDeviceBuyOrBingStatus(@RequestParam("deviceUnique") String deviceUnique);

    /**
     * <desc>
     *      通过百度指纹码绑定百度识别码来完成离线人脸识别
     * <desc/>
     *
     * @param sn
     * @param baiduId 百度指纹码
     * @return
     * @author Juguang.S
     * @createDate 2019/02/26
     */
    @PostMapping(path = "smartCommunity/interface/device/bingBaiduCode")
    String getBaiduCode(@RequestParam("sn") String sn,@RequestParam("baiduId") String baiduId) throws Exception;

    /**
     * <desc>
     *      根据设备编号获取访客信息
     * </desc>
     *
     * @param deviceUnique 设备唯一码
     * @param smartType 云对讲类型，31-门口机，32-围墙机
     * @return
     * @author Qiang.S
     * @createDate 2019/02/28
     */
    @PostMapping(path = "smartCommunity/interface/device/getVisitorInfoByUnique")
    List<CloudIntercomVisitorVO> getVisitorInfoByUnique(@RequestParam("deviceUnique") String deviceUnique, @RequestParam("smartType") Integer smartType);

    /**
     * <desc>
     *     通知云端升级失败原因
     * </desc>
     *
     * @param sn
     * @param id 轮询命令
     * @param msg 失败原因
     * @return 受影响的行数
     * @throws Exception
     * @author Qiang.S
     * @createDate 2019-08-12
     */
    @PostMapping(path = "smartCommunity/interface/device/reportUpdateResult")
    Integer reportUpdateResult(@RequestParam("sn") String sn,
                               @RequestParam("id") String id,
                               @RequestParam("msg") String msg) throws Exception;

    /**
     * <desc>
     *      云对讲iot开门
     * </desc>
     *
     * @param userId 用户编号
     * @param sipAccount sip帐号
     * @param message 指令相关信息
     * @param timeout 开门时长
     * @return
     * @author Qiang.S
     * @createDate 2019/07/16
     */
    @RequestMapping(path = "smartCommunity/interface/device/iotOpenDoor",method = {RequestMethod.POST})
    void iotOpenDoor(@RequestParam("userId") String userId, @RequestParam("sipAccount") String sipAccount,
                               @RequestParam("message") String message, @RequestParam("timeout") String timeout);

    /**
     * <desc>
     *      云对讲iot音视频切换
     * </desc>
     *
     * @param sipAccount sip帐号
     * @param message 指令相关信息
     * @return
     * @author Qiang.S
     * @createDate 2019/07/16
     */
    @RequestMapping(path = "smartCommunity/interface/device/switchVideo",method = {RequestMethod.POST})
    void switchVideo(@RequestParam("sipAccount") String sipAccount, @RequestParam("message") String message);

    /**
     * <desc>
     *      根据sip帐号获取设备编号云对讲
     * </desc>
     *
     * @param sipAccount sip帐号
     * @return
     * @author Qiang.S
     * @createDate 2019/07/22
     */
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceUniqueBySip",method = {RequestMethod.POST})
    String getDeviceUniqueBySip(@RequestParam("sipAccount") String sipAccount);


    /**
     * <desc>
     *      获取云对讲黑名单
     * </desc>
     *
     * @param sn
     * @param page
     * @param pageSize
     * @return
     * @author Jiaqi.X
     * @createDate 2019/10/14
     */
    @RequestMapping(path = "smartCommunity/interface/device/pullBlackList",method = {RequestMethod.POST})
    DeviceBlackListPageVO<BlackListVO> pullBlackList(@RequestParam("sn") String sn,@RequestParam("page") String page,
                                                     @RequestParam("pageSize") String pageSize);
     /*
     * <desc>
     *      获取门禁、联动器临时权限
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.X
     * @createDate 2019/09/11
     */
    @RequestMapping(path = "smartCommunity/interface/device/getTempAuths",method = {RequestMethod.POST})
    DeviceAuthTempPageVO<EntranceTempAuthVO> getTempAuths(@RequestParam("sn") String sn,@RequestParam("currentPage") String currentPage,@RequestParam("pageSize")String pageSize) throws Exception;

    /**
     * <desc>
     *      根据sn获取该设备所对应批次号的云服务过期时间
     * </desc>
     *
     * @param sn
     * @return
     * @author Juguang.S
     * @createDate 2019/11/26
     */
    @RequestMapping(path = "smartCommunity/interface/device/getEndTimeBySn")
    String getEndTimeBySn(@RequestParam("sn") String sn);



    /**
     * <desc>
     *      获取云对讲地址信息
     * </desc>
     *
     * @param deviceUnique
     * @return
     * @author Jiaqi.X
     * @createDate 2019/10/14
     */
    @RequestMapping(path = "smartCommunity/interface/device/getAddressByDeviceUnique")
    Map<String,Object> getAddressByDeviceUnique(@RequestParam("deviceUnique") String deviceUnique);
    /**
     *<desc>
     * 获取单元id
     *</desc>
     *
     * @Author  chengshican
     * @Date   2020-12-08 13:51
     * @Param
     * @Return
     * @Exception
     *
     */
    @RequestMapping(path = "smartCommunity/interface/device/getUnitIdByRoomInfoId", method = {RequestMethod.POST})
     RoomInfoPO getUnitIdByRoomInfoId(@RequestParam("roomId") String roomId);



    /**
     *<desc>
     * 通过设备的唯一标识查询设备所在地址
     *</desc>
     *
     * @Author  chengshican
     * @Date   2021-01-27 9:55
     * @Param  deviceUnique 设备唯一标识符
     * @Return   buildId 楼栋id   unitId  单元id
     * @Exception
     *
     */
    @RequestMapping(path = "smartCommunity/interface/device/getUnitIdByDeviceUnique", method = {RequestMethod.POST})
    List<Map<String,String>> getUnitIdByDeviceUnique(@RequestParam("deviceUnique") String deviceUnique) throws Exception;;

    /**
     *<desc>
     * 通过设备的唯一标识查询设备所在地址
     *</desc>
     *
     * @Author  chengshican
     * @Date   2021-01-27 9:55
     * @Param  deviceUnique 设备唯一标识符
     * @Return   buildId 楼栋id   unitId  单元id
     * @Exception
     *
     */
    @RequestMapping(path = "smartCommunity/interface/device/getUnitIdByEntranceDeviceUnique", method = {RequestMethod.POST})
    List<Map<String,String>> getUnitIdByEntranceDeviceUnique(@RequestParam("deviceUnique") String deviceUnique) throws Exception;;

    /**
     *<desc>
     * 根据地址获取电梯设备信息
     *</desc>
     *
     * @Author  chengshican
     * @Date   2021-01-27 9:55
     * @Param  buildId 楼栋id   unitId  单元id
     * @Return    deviceUnique 电梯设备的唯一标识符    liftDoorType 正背门信息  （正背门 1正门 0背门）
     * @Exception
     *
     */
    @RequestMapping(path = "smartCommunity/interface/device/getElevatorLiftDoorTypeListByAddress", method = {RequestMethod.POST})
    List<CloudElevatorVO> getElevatorLiftDoorTypeListByAddress(Map<String,String> address) throws Exception;;

}
